#pragma  once
#include "headers.h"


class MenuBuilder{
public:
	MenuBuilder(HMENU menu = 0);
	MenuBuilder(const MenuBuilder& other);
public:
	void Create();
	void CreateAsSub();
	void CreateAsPopup();
	
	HMENU GetMenu();
	operator HMENU();
	MenuBuilder& operator =(HMENU m);
	int GetItemCount();

	void DeleteItemCmd(UINT cmd);
	void DeleteItemIndex(int  index);

	void CheckItemIndex(int index, bool check = true);
	void CheckItemCmd(UINT cmd, bool check = true);

	BOOL AppendSubMenu(wstring text, HMENU subMenu);
	BOOL InsertSubMenu(int index, wstring text, HMENU subMenu);
	HMENU GetSubMenu(wstring text);
	bool IsSubMenu(int index);
	HMENU GetSubMenu(int index);

	BOOL AppendSeprator();
	BOOL InsertSepratorIndex(int index);
	BOOL InsertSepratorCmd(UINT cmd);

	BOOL AppendItem(UINT cmd, wstring text);
	BOOL InsertItemIndex(int index, UINT cmd, wstring text);
	BOOL InsertItemCmd(UINT relCmd, UINT cmd, wstring text);

	BOOL SetItemStringIndex(int index, wstring text);
	BOOL SetItemStringCmd(UINT cmd, wstring text);
	wstring GetItemStringIndex(int index);
	wstring GetItemStringCmd(UINT cmd);
private:
	HMENU menu_;
};
